<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>二手车评估</title>
<link href="../../css/newStyle.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/manhuaDate.1.0.js"></script>
<script type="text/javascript" src="../../js/gbRst.js"></script>
<script type="text/javascript" src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/openId.js"></script>
<script type="text/javascript" src="../../js/header&footer.js"></script>
<!-- <script type="text/javascript" src="../../js/carService.js"></script>
 -->
<script type="text/javascript" src="../../js/check.js"></script>
<script type="text/javascript" src="../../js/qmsk-1.2.js"></script>
<script type="text/javascript">
var memberId=0
var userId =0;
$(function(){
	userId = getIdByName('id');
	var  user= _findInfo("../../../user/find/userById", {'id':getIdByName('id')});
	if(user.state==0){
		$("#dutyName").html(getHtmlString(getHeadIndexValue(0, user, "dutyName")))
		$("#dutyer").html(getHtmlString(getHeadIndexValue(0, user, "Name")))
		userId = getHtmlInt(getHeadIndexValue(0, user, "ID"));
	}
	var  member=_findInfo("../../../member/find/shopId/"+getShopId()+"/openId/"+getOpenId(), null)
	if(IsNotEmpty(member)&&member.state==0){
		if(member.result.data.length>0){
		$("#custName").val(getHtmlString(getHeadIndexValue(0, member, "CustomerName")))
		$("#mp").val(getHtmlString(getHeadIndexValue(0, member, "mp")))
		memberId=getHtmlString(getHeadIndexValue(0, member, "memberId"));
		}
	}
	var time = _findInfo("../../../tryTime/find/timeList/shopId/"+getShopId(), null)
	if(IsNotEmpty(time)&&time.state==0){
		for ( var i = 0; i < time.result.data.length; i++) {
			var htm="<option value='"+getHtmlInt(getHeadIndexValue(i, time, "id"))+"'>"+getHtmlString(getHeadIndexValue(i, time, "name"))+"</option>";
		$("#time").append(htm)
	}
	}
});

function save(){
	addInfo()
}

function addInfo(){
	var shopId = getShopId();
	var name= $("#custName").val();
	var mp= $("#mp").val().replace(/\s/gi,'');
	var carTypeName= $("#carType").val();
	var memo= $("#memo").val();
	var price= $("#price").val();
	var firstTime= $("#firstTime").val();
	var mileage= $("#mileage").val();
	var endTime= $("#endTime").val();
	var expirationTime= $("#expirationTime").val();
	var gearbox= $("#gearbox").val();
	var color= $("#color").val();
	var emission= $("#emission").val();
	var Discharge= $("#Discharge").val();
	var color= $("#color").val();
	var License = $("#License").val()
	if(!checkNull(name, "姓名", 'custName')||!_checkPhone(mp, false, '手机', 'mp')){
		return false;
	}
	if(!checkNull(firstTime, "首次上牌时间", null)||!checkNull(mileage, '里程数', null)||!checkNull(endTime, "年检到期时间", null)){
		return false;
	}
	
	if(!_checkMoney(price, false, "期望售价", "price")){
		return false;
	}
	if(!_checkMoney(mileage, false, "里程数", "mileage")){
		return false;
	}
	var heads=new Array('shopId','customerId','customerName','mp','carTypeName','price','memo','userId','firstTime','endTime','BillFrom','mileage','expirationTime','gearbox','discharge','color','emission','License','memberId')
	var datas=new Array(shopId,memberId,name,mp,carTypeName,price,memo,userId,firstTime,endTime,'WX',mileage,expirationTime,gearbox,Discharge,color,emission,License,memberId)
	var params= _getJsonParseInsertStr(heads, datas);
	var dt=_insertInfoNoSucceedMessage("../../../reassessRecord/insert/insertInfo", {'data':params});
	if(dt.state==0){
		alert("提交成功")
		restForm();
	}
}

function restForm(){
	$("#dateTime").val("");
	$("#memo").val("");
	$("#firstTime").val("");
	$("#mileage").val("");
	$("#endTime").val("");
	$("#expirationTime").val("");
	$("#gearbox").val("");
	$("#color").val("");
	$("#emission").val("");
	$("#Discharge").val("");
	$("#price").val("");
	$("#License").val("");
	
}

</script>
</head>

<body>
<div class="wrapper">
  <div class="container">
    <h2 class="xilie"><span>二手车评估登记表</span></h2>
     		<p class="person" ><span>评估顾问</span>：<span id="dutyer">张勇</span></p>
        <div class="person">
            姓名<span class="red">*</span><br>
            <input id="custName" name="custName" type="text" class="txt">
        </div>
        <div class="person">
            手机号<span class="red">*</span><br>
            <input id="mp" name="mp" type="text" class="txt">
        </div>
        <div class="person">
            车牌号码<span class="red">*</span><br>
            <input id="License" name="License" type="text" class="txt">
        </div>
        <div class="person" style="margin-bottom:14px;">
            车型<span class="red">*</span><br>
             <input id="carType" name="carType" type="text" class="txt mar">
           
            <i class="appDate">期望售价<span class="red">*</span><br><input id="price" type="text" class="txt"></i>
        </div>
        <div class="person">首次上牌时间<span class="red">*</span><br><input type="text" class="txt mar doubledate" readonly id="firstTime"><i class="appDate">里程数<span class="red">*</span><br><input id="mileage" type="text" class="txt"></i></div>
        <div class="person">年检到期时间<span class="red">*</span><br><input type="text" class="txt mar doubledate" id="endTime" readonly><i class="appDate">保险到期时间<span class="red">*</span><br><input type="text" class="txt doubledate" id="expirationTime" readonly></i></div>
        <div class="person">变速箱<span class="red">*</span><br>
        <input id="gearbox" type="text" class="txt mar">
<!--         <select style="width:47.5%;"><option>请选择</option><option>自动</option><option>手自一体</option></select>
 -->        <i class="appDate">颜色<span class="red">*</span><br>
         <input id="color" type="text" class="txt">
 
<!--  <select><option>请选择</option><option>蓝</option><option>黑</option></select>
 --> </i></div>
        <div class="person" style="margin-bottom:14px;">
            排放标准<span class="red">*</span><br>
         <input id="emission" type="text" class="txt mar">
           <!--  <select style="width:47.5%;">
            	<option>请选择</option>
                <option>一汽大众</option>
                <option>奥迪</option>
            </select> -->
            <i class="appDate">排量<span class="red">*</span><br><input id="Discharge" type="text" class="txt"></i>
        </div>
        <div class="person">
            备注	<br>
            <textarea id="memo"></textarea>
        </div>
        <div class="give">
            <input type="button" value="提交评估表" class="giveBtn" onclick="save()">
        </div>
  </div>
</div>
</body>
</html>
